home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / RTLWIN16.PAK / DDEML.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  16KB  |  466 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. *  ddeml.h -    DDEML API header file                                         *
  4. *                                                                             *
  5. \*****************************************************************************/
  6.  
  7. /* $Copyright: 1994$ */
  8.  
  9. #ifndef __DDEML_H       /* prevent multiple includes */
  10. #define __DDEML_H
  11.  
  12. #ifndef __WINDOWS_H
  13. #include <windows.h>    /* <windows.h> must be included */
  14. #endif  /* __WINDOWS_H */
  15.  
  16. #ifndef RC_INVOKED
  17. #pragma pack(push, 1)   /* Assume byte packing throughout */
  18. #endif  /* RC_INVOKED */
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {            /* Assume C declarations for C++ */
  22. #endif /* __cplusplus */
  23.  
  24. /* If included with the 3.0 windows.h, define compatible aliases */
  25. #if !defined(WINVER) || (WINVER < 0x030a)
  26. #define LPCSTR      LPSTR
  27. #define WINAPI      FAR PASCAL
  28. #define CALLBACK    FAR PASCAL
  29. #define UINT        WORD
  30. #define LPARAM      LONG
  31. #define WPARAM      WORD
  32. #define LRESULT     LONG
  33. #define HMODULE     HANDLE
  34. #define HINSTANCE   HANDLE
  35. #define HLOCAL      HANDLE
  36. #define HGLOBAL     HANDLE
  37. #endif  /* WIN3.0 */
  38.  
  39. #ifndef DECLARE_HANDLE32
  40. #ifdef STRICT
  41. #define DECLARE_HANDLE32(name)  struct name##__ { int unused; }; \
  42.                                 typedef const struct name##__ _far* name
  43. #else   /* STRICT */
  44. #define DECLARE_HANDLE32(name)  typedef DWORD name
  45. #endif  /* !STRICT */
  46. #endif  /* !DECLARE_HANDLE32 */
  47.  
  48. #define EXPENTRY    WINAPI
  49.  
  50. /******** public types ********/
  51.  
  52. DECLARE_HANDLE32(HCONVLIST);
  53. DECLARE_HANDLE32(HCONV);
  54. DECLARE_HANDLE32(HDDEDATA);
  55. #if !defined(_HSZ_DEFINED)
  56. #define _HSZ_DEFINED
  57. DECLARE_HANDLE32(HSZ);
  58. #endif
  59.  
  60. /* the following structure is for use with XTYP_WILDCONNECT processing. */
  61.  
  62. typedef struct tagHSZPAIR
  63. {
  64.     HSZ hszSvc;
  65.     HSZ hszTopic;
  66. } HSZPAIR;
  67. typedef HSZPAIR FAR *PHSZPAIR;
  68.  
  69. /* The following structure is used by DdeConnect() and DdeConnectList() and
  70.    by XTYP_CONNECT and XTYP_WILDCONNECT callbacks. */
  71.  
  72. typedef struct tagCONVCONTEXT
  73. {
  74.     UINT        cb;             /* set to sizeof(CONVCONTEXT) */
  75.     UINT        wFlags;         /* none currently defined. */
  76.     UINT        wCountryID;     /* country code for topic/item strings used. */
  77.     int         iCodePage;      /* codepage used for topic/item strings. */
  78.     DWORD       dwLangID;       /* language ID for topic/item strings. */
  79.     DWORD       dwSecurity;     /* Private security code. */
  80. } CONVCONTEXT;
  81. typedef CONVCONTEXT FAR *PCONVCONTEXT;
  82.  
  83. /* The following structure is used by DdeQueryConvInfo(): */
  84.  
  85. typedef struct tagCONVINFO
  86. {
  87.     DWORD   cb;            /* sizeof(CONVINFO)  */
  88.     DWORD   hUser;         /* user specified field  */
  89.     HCONV   hConvPartner;  /* hConv on other end or 0 if non-ddemgr partner  */
  90.     HSZ     hszSvcPartner; /* app name of partner if obtainable  */
  91.     HSZ     hszServiceReq; /* AppName requested for connection  */
  92.     HSZ     hszTopic;      /* Topic name for conversation  */
  93.     HSZ     hszItem;       /* transaction item name or NULL if quiescent  */
  94.     UINT    wFmt;          /* transaction format or NULL if quiescent  */
  95.     UINT    wType;         /* XTYP_ for current transaction  */
  96.     UINT    wStatus;       /* ST_ constant for current conversation  */
  97.     UINT    wConvst;       /* XST_ constant for current transaction  */
  98.     UINT    wLastError;    /* last transaction error.  */
  99.     HCONVLIST hConvList;   /* parent hConvList if this conversation is in a list */
  100.     CONVCONTEXT ConvCtxt;  /* conversation context */
  101. } CONVINFO;
  102. typedef CONVINFO FAR *PCONVINFO;
  103.  
  104. /***** conversation states (usState) *****/
  105.  
  106. #define     XST_NULL              0  /* quiescent states */
  107. #define     XST_INCOMPLETE        1
  108. #define     XST_CONNECTED         2
  109. #define     XST_INIT1             3  /* mid-initiation states */
  110. #define     XST_INIT2             4
  111. #define     XST_REQSENT           5  /* active conversation states */
  112. #define     XST_DATARCVD          6
  113. #define     XST_POKESENT          7
  114. #define     XST_POKEACKRCVD       8
  115. #define     XST_EXECSENT          9
  116. #define     XST_EXECACKRCVD      10
  117. #define     XST_ADVSENT          11
  118. #define     XST_UNADVSENT        12
  119. #define     XST_ADVACKRCVD       13
  120. #define     XST_UNADVACKRCVD     14
  121. #define     XST_ADVDATASENT      15
  122. #define     XST_ADVDATAACKRCVD   16
  123.  
  124. /* used in LOWORD(dwData1) of XTYP_ADVREQ callbacks... */
  125. #define     CADV_LATEACK         0xFFFF
  126.  
  127. /***** conversation status bits (fsStatus) *****/
  128.  
  129. #define     ST_CONNECTED        0x0001
  130. #define     ST_ADVISE           0x0002
  131. #define     ST_ISLOCAL          0x0004
  132. #define     ST_BLOCKED          0x0008
  133. #define     ST_CLIENT           0x0010
  134. #define     ST_TERMINATED       0x0020
  135. #define     ST_INLIST           0x0040
  136. #define     ST_BLOCKNEXT        0x0080
  137. #define     ST_ISSELF           0x0100
  138.  
  139. /* DDE constants for wStatus field */
  140.  
  141. #define DDE_FACK                0x8000
  142. #define DDE_FBUSY               0x4000
  143. #define DDE_FDEFERUPD           0x4000
  144. #define DDE_FACKREQ             0x8000
  145. #define DDE_FRELEASE            0x2000
  146. #define DDE_FREQUESTED          0x1000
  147. #define DDE_FACKRESERVED        0x3ff0
  148. #define DDE_FADVRESERVED        0x3fff
  149. #define DDE_FDATRESERVED        0x4fff
  150. #define DDE_FPOKRESERVED        0xdfff
  151. #define DDE_FAPPSTATUS          0x00ff
  152. #define DDE_FNOTPROCESSED       0x0000
  153.  
  154. /***** message filter hook types *****/
  155.  
  156. #define     MSGF_DDEMGR             0x8001
  157.  
  158. /***** codepage constants ****/
  159.  
  160. #define CP_WINANSI      1004    /* default codepage for windows & old DDE convs. */
  161.  
  162. /***** transaction types *****/
  163.  
  164. #define     XTYPF_NOBLOCK            0x0002  /* CBR_BLOCK will not work */
  165. #define     XTYPF_NODATA             0x0004  /* DDE_FDEFERUPD */
  166. #define     XTYPF_ACKREQ             0x0008  /* DDE_FACKREQ */
  167.  
  168. #define     XCLASS_MASK              0xFC00
  169. #define     XCLASS_BOOL              0x1000
  170. #define     XCLASS_DATA              0x2000
  171. #define     XCLASS_FLAGS             0x4000
  172. #define     XCLASS_NOTIFICATION      0x8000
  173.  
  174. #define     XTYP_ERROR              (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
  175. #define     XTYP_ADVDATA            (0x0010 | XCLASS_FLAGS         )
  176. #define     XTYP_ADVREQ             (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK )
  177. #define     XTYP_ADVSTART           (0x0030 | XCLASS_BOOL          )
  178. #define     XTYP_ADVSTOP            (0x0040 | XCLASS_NOTIFICATION)
  179. #define     XTYP_EXECUTE            (0x0050 | XCLASS_FLAGS         )
  180. #define     XTYP_CONNECT            (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
  181. #define     XTYP_CONNECT_CONFIRM    (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  182. #define     XTYP_XACT_COMPLETE      (0x0080 | XCLASS_NOTIFICATION  )
  183. #define     XTYP_POKE               (0x0090 | XCLASS_FLAGS         )
  184. #define     XTYP_REGISTER           (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  185. #define     XTYP_REQUEST            (0x00B0 | XCLASS_DATA          )
  186. #define     XTYP_DISCONNECT         (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  187. #define     XTYP_UNREGISTER         (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  188. #define     XTYP_WILDCONNECT        (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
  189.  
  190. #define     XTYP_MASK                0x00F0
  191. #define     XTYP_SHIFT               0x0004  /* shift to turn XTYP_ into an index */
  192.  
  193. /***** Timeout constants *****/
  194.  
  195. #define     TIMEOUT_ASYNC           -1L
  196.  
  197. /***** Transaction ID constants *****/
  198.  
  199. #define     QID_SYNC                -1L
  200.  
  201. /****** public strings used in DDE ******/
  202.  
  203. #define SZDDESYS_TOPIC          "System"
  204. #define SZDDESYS_ITEM_TOPICS    "Topics"
  205. #define SZDDESYS_ITEM_SYSITEMS  "SysItems"
  206. #define SZDDESYS_ITEM_RTNMSG    "ReturnMessage"
  207. #define SZDDESYS_ITEM_STATUS    "Status"
  208. #define SZDDESYS_ITEM_FORMATS   "Formats"
  209. #define SZDDESYS_ITEM_HELP      "Help"
  210. #define SZDDE_ITEM_ITEMLIST     "TopicItemList"
  211.  
  212.  
  213. /****** API entry points ******/
  214.  
  215. typedef HDDEDATA CALLBACK FNCALLBACK(UINT wType, UINT wFmt, HCONV hConv,
  216.         HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2);
  217. typedef FNCALLBACK *PFNCALLBACK;
  218.  
  219. #define     CBR_BLOCK                0xffffffffL
  220.  
  221. /* DLL registration functions */
  222.  
  223. UINT    WINAPI DdeInitialize(DWORD FAR* pidInst, PFNCALLBACK pfnCallback,
  224.                 DWORD afCmd, DWORD ulRes);
  225.  
  226. /*
  227.  * Callback filter flags for use with standard apps.
  228.  */
  229.  
  230. #define     CBF_FAIL_SELFCONNECTIONS     0x00001000L
  231. #define     CBF_FAIL_CONNECTIONS         0x00002000L
  232. #define     CBF_FAIL_ADVISES             0x00004000L
  233. #define     CBF_FAIL_EXECUTES            0x00008000L
  234. #define     CBF_FAIL_POKES               0x00010000L
  235. #define     CBF_FAIL_REQUESTS            0x00020000L
  236. #define     CBF_FAIL_ALLSVRXACTIONS      0x0003f000L
  237.  
  238. #define     CBF_SKIP_CONNECT_CONFIRMS    0x00040000L
  239. #define     CBF_SKIP_REGISTRATIONS       0x00080000L
  240. #define     CBF_SKIP_UNREGISTRATIONS     0x00100000L
  241. #define     CBF_SKIP_DISCONNECTS         0x00200000L
  242. #define     CBF_SKIP_ALLNOTIFICATIONS    0x003c0000L
  243.  
  244. /*
  245.  * Application command flags
  246.  */
  247. #define     APPCMD_CLIENTONLY            0x00000010L
  248. #define     APPCMD_FILTERINITS           0x00000020L
  249. #define     APPCMD_MASK                  0x00000FF0L
  250.  
  251. /*
  252.  * Application classification flags
  253.  */
  254. #define     APPCLASS_STANDARD            0x00000000L
  255. #define     APPCLASS_MASK                0x0000000FL
  256.  
  257.  
  258. BOOL    WINAPI DdeUninitialize(DWORD idInst);
  259.  
  260. /* conversation enumeration functions */
  261.  
  262. HCONVLIST WINAPI DdeConnectList(DWORD idInst, HSZ hszService, HSZ hszTopic,
  263.             HCONVLIST hConvList, CONVCONTEXT FAR* pCC);
  264. HCONV   WINAPI DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev);
  265. BOOL    WINAPI DdeDisconnectList(HCONVLIST hConvList);
  266.  
  267. /* conversation control functions */
  268.  
  269. HCONV   WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
  270.             CONVCONTEXT FAR* pCC);
  271. BOOL    WINAPI DdeDisconnect(HCONV hConv);
  272. HCONV   WINAPI DdeReconnect(HCONV hConv);
  273.  
  274. UINT    WINAPI DdeQueryConvInfo(HCONV hConv, DWORD idTransaction, CONVINFO FAR* pConvInfo);
  275. BOOL    WINAPI DdeSetUserHandle(HCONV hConv, DWORD id, DWORD hUser);
  276.  
  277. BOOL    WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction);
  278.  
  279.  
  280. /* app server interface functions */
  281.  
  282. BOOL    WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem);
  283. BOOL    WINAPI DdeEnableCallback(DWORD idInst, HCONV hConv, UINT wCmd);
  284.  
  285. #define EC_ENABLEALL            0
  286. #define EC_ENABLEONE            ST_BLOCKNEXT
  287. #define EC_DISABLE              ST_BLOCKED
  288. #define EC_QUERYWAITING         2
  289.  
  290. HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd);
  291.  
  292. #define DNS_REGISTER        0x0001
  293. #define DNS_UNREGISTER      0x0002
  294. #define DNS_FILTERON        0x0004
  295. #define DNS_FILTEROFF       0x0008
  296.  
  297. /* app client interface functions */
  298.  
  299. HDDEDATA WINAPI DdeClientTransaction(void FAR* pData, DWORD cbData,
  300.         HCONV hConv, HSZ hszItem, UINT wFmt, UINT wType,
  301.         DWORD dwTimeout, DWORD FAR* pdwResult);
  302.  
  303. /* data transfer functions */
  304.  
  305. HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, void FAR* pSrc, DWORD cb,
  306.             DWORD cbOff, HSZ hszItem, UINT wFmt, UINT afCmd);
  307. HDDEDATA WINAPI DdeAddData(HDDEDATA hData, void FAR* pSrc, DWORD cb, DWORD cbOff);
  308. DWORD   WINAPI DdeGetData(HDDEDATA hData, void FAR* pDst, DWORD cbMax, DWORD cbOff);
  309. BYTE FAR* WINAPI DdeAccessData(HDDEDATA hData, DWORD FAR* pcbDataSize);
  310. BOOL    WINAPI DdeUnaccessData(HDDEDATA hData);
  311. BOOL    WINAPI DdeFreeDataHandle(HDDEDATA hData);
  312.  
  313. #define     HDATA_APPOWNED          0x0001
  314.  
  315.  
  316.  
  317. UINT WINAPI DdeGetLastError(DWORD idInst);
  318.  
  319. #define     DMLERR_NO_ERROR                    0       /* must be 0 */
  320.  
  321. #define     DMLERR_FIRST                       0x4000
  322.  
  323. #define     DMLERR_ADVACKTIMEOUT               0x4000
  324. #define     DMLERR_BUSY                        0x4001
  325. #define     DMLERR_DATAACKTIMEOUT              0x4002
  326. #define     DMLERR_DLL_NOT_INITIALIZED         0x4003
  327. #define     DMLERR_DLL_USAGE                   0x4004
  328. #define     DMLERR_EXECACKTIMEOUT              0x4005
  329. #define     DMLERR_INVALIDPARAMETER            0x4006
  330. #define     DMLERR_LOW_MEMORY                  0x4007
  331. #define     DMLERR_MEMORY_ERROR                0x4008
  332. #define     DMLERR_NOTPROCESSED                0x4009
  333. #define     DMLERR_NO_CONV_ESTABLISHED         0x400a
  334. #define     DMLERR_POKEACKTIMEOUT              0x400b
  335. #define     DMLERR_POSTMSG_FAILED              0x400c
  336. #define     DMLERR_REENTRANCY                  0x400d
  337. #define     DMLERR_SERVER_DIED                 0x400e
  338. #define     DMLERR_SYS_ERROR                   0x400f
  339. #define     DMLERR_UNADVACKTIMEOUT             0x4010
  340. #define     DMLERR_UNFOUND_QUEUE_ID            0x4011
  341.  
  342. #define     DMLERR_LAST                        0x4011
  343.  
  344. HSZ     WINAPI DdeCreateStringHandle(DWORD idInst, LPCSTR psz, int iCodePage);
  345. DWORD   WINAPI DdeQueryString(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, int iCodePage);
  346. BOOL    WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz);
  347. BOOL    WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz);
  348. int     WINAPI DdeCmpStringHandles(HSZ hsz1, HSZ hsz2);
  349.  
  350.  
  351. #ifndef NODDEMLSPY
  352. /* */
  353. /* DDEML public debugging header file info */
  354. /* */
  355.  
  356. typedef struct tagMONMSGSTRUCT
  357. {
  358.     UINT    cb;
  359.     HWND    hwndTo;
  360.     DWORD   dwTime;
  361.     HANDLE  hTask;
  362.     UINT    wMsg;
  363.     WPARAM  wParam;
  364.     LPARAM  lParam;
  365. } MONMSGSTRUCT;
  366.  
  367. typedef struct tagMONCBSTRUCT
  368. {
  369.     UINT   cb;
  370.     WORD   wReserved;
  371.     DWORD  dwTime;
  372.     HANDLE hTask;
  373.     DWORD  dwRet;
  374.     UINT   wType;
  375.     UINT   wFmt;
  376.     HCONV  hConv;
  377.     HSZ    hsz1;
  378.     HSZ    hsz2;
  379.     HDDEDATA hData;
  380.     DWORD  dwData1;
  381.     DWORD  dwData2;
  382. } MONCBSTRUCT;
  383.  
  384. typedef struct tagMONHSZSTRUCT
  385. {
  386.     UINT   cb;
  387.     BOOL   fsAction;    /* MH_ value */
  388.     DWORD  dwTime;
  389.     HSZ    hsz;
  390.     HANDLE hTask;
  391.     WORD   wReserved;
  392.     char   str[1];
  393. } MONHSZSTRUCT;
  394.  
  395. #define MH_CREATE   1
  396. #define MH_KEEP     2
  397. #define MH_DELETE   3
  398. #define MH_CLEANUP  4
  399.  
  400.  
  401. typedef struct tagMONERRSTRUCT
  402. {
  403.     UINT    cb;
  404.     UINT    wLastError;
  405.     DWORD   dwTime;
  406.     HANDLE  hTask;
  407. } MONERRSTRUCT;
  408.  
  409. typedef struct tagMONLINKSTRUCT
  410. {
  411.     UINT    cb;
  412.     DWORD   dwTime;
  413.     HANDLE  hTask;
  414.     BOOL    fEstablished;
  415.     BOOL    fNoData;
  416.     HSZ     hszSvc;
  417.     HSZ     hszTopic;
  418.     HSZ     hszItem;
  419.     UINT    wFmt;
  420.     BOOL    fServer;
  421.     HCONV   hConvServer;
  422.     HCONV   hConvClient;
  423. } MONLINKSTRUCT;
  424.  
  425. typedef struct tagMONCONVSTRUCT
  426. {
  427.     UINT    cb;
  428.     BOOL    fConnect;
  429.     DWORD   dwTime;
  430.     HANDLE  hTask;
  431.     HSZ     hszSvc;
  432.     HSZ     hszTopic;
  433.     HCONV   hConvClient;
  434.     HCONV   hConvServer;
  435. } MONCONVSTRUCT;
  436.  
  437. #define     MAX_MONITORS            4
  438. #define     APPCLASS_MONITOR        0x00000001L
  439. #define     XTYP_MONITOR            (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  440.  
  441. /*
  442.  * Callback filter flags for use with MONITOR apps - 0 implies no monitor
  443.  * callbacks.
  444.  */
  445. #define     MF_HSZ_INFO                  0x01000000L
  446. #define     MF_SENDMSGS                  0x02000000L
  447. #define     MF_POSTMSGS                  0x04000000L
  448. #define     MF_CALLBACKS                 0x08000000L
  449. #define     MF_ERRORS                    0x10000000L
  450. #define     MF_LINKS                     0x20000000L
  451. #define     MF_CONV                      0x40000000L
  452.  
  453. #define     MF_MASK                      0xFF000000L
  454. #endif /* NODDEMLSPY */
  455.  
  456. #ifdef __cplusplus
  457. }                       /* End of extern "C" { */
  458. #endif  /* __cplusplus */
  459.  
  460. #ifndef RC_INVOKED
  461. #pragma pack(pop)       /* Revert to default packing */
  462. #endif  /* RC_INVOKED */
  463.  
  464. #endif  /* __DDEML_H */
  465.  
  466.